using UnityEngine;
using UnityEngine.UI;

namespace Gj
{
    public class TipsHelper : NodeHelper
    {
        public RectTransform tipsItem;

        protected override BindDataType bindDataType => BindDataType.Bool;

        // Use this for initialization
        protected override void Start()
        {
            base.Start();
            gameObject.AddComponent<Button>().onClick.AddListener(Close);
        }

        protected override void BindData(bool b)
        {
            gameObject.SetActive(b);
            if (b)
            {
                tipsItem.position = SystemInput.cp;
                SetChildData(_data);
            }
        }

        public void Close()
        {
            Emit(UIEvent.Close);
        }
    }
}